//
//  MoreStoryViewController.m
//  Travel
//
//  Created by 王嘉倩 on 15/9/19.
//  Copyright (c) 2015年 TeamThree. All rights reserved.
//

#import "MoreStoryViewController.h"
#import "WonderfulStroyCollectionViewCell.h"
@interface MoreStoryViewController () <UICollectionViewDataSource, UICollectionViewDelegate>

@property (nonatomic, retain) UICollectionView *collectionView;

@end

@implementation MoreStoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setUpMoreStoryView];
}

- (void)setUpMoreStoryView {
    
    // 设置collectionView
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.minimumLineSpacing = 10;
    layout.itemSize = CGSizeMake((kWidth - 30) / 2, 220);
    layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    _collectionView = [[UICollectionView alloc] initWithFrame:kBounds collectionViewLayout:layout];
    _collectionView.backgroundColor = [UIColor colorWithRed:0.969 green:0.949 blue:0.902 alpha:1.000];
    _collectionView.delegate = self;
    _collectionView.dataSource = self;
    [self.view addSubview:_collectionView];
    [_collectionView registerClass:[WonderfulStroyCollectionViewCell class] forCellWithReuseIdentifier:@"WonderfulCell"];
    [layout release];
}

#pragma mark --------------- collectionView代理 ----------------

// 返回分区的行数
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 11;
}
// 设置collectionView的cell
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    WonderfulStroyCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"WonderfulCell" forIndexPath:indexPath];
    return cell;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
